﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<MvcFinalTest.Models.EmployeeModel>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	List of Employee
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>List of Employee</h2>
    <% if (ViewData["EmployeeData"].Equals("0"))
       { %>
            <p><i>(Contains No Data)</i></p>
    <% }
       else
       { %>
    <% using (Html.BeginForm("Search","Employee")) {%>
     <table>
        <tr>
            <td><%: Html.Label("First Name") %></td>
            <td><%: Html.TextBox("FirstName") %></td>
            <td>
            <p>
                <input type="submit" value="Search" />
            </p>
            </td>
        </tr>        
     </table>       
    <% } %>
    <br />
    
    <table>
        <tr>
            <th></th>
            <th>
                Employee ID
            </th>
            <th>
                First Name
            </th>
            <th>
                Last Name
            </th>
            <th>
                Email
            </th>
            <th>
                Address
            </th>           
            <th>
                Branch
            </th>
            <th>
                Job Type
            </th>
        </tr>
    
    <% foreach (var item in Model)
       { %>
    
        <tr>
            <td>
                <%: Html.ActionLink("Edit", "Edit", new { id = item.EmployeeId })%> |
                <%: Html.ActionLink("Details", "Details", new { id = item.EmployeeId })%> |
                <%: Html.ActionLink("Delete", "Delete", new { id = item.EmployeeId }, new { onclick = "return confirm('Are you sure you want to delete?')" })%>
            </td>
            <td>
                <%: item.EmployeeId%>
            </td>
            <td>
                <%: item.FirstName%>
            </td>
            <td>
                <%: item.LastName%>
            </td>
            <td>
                <%: item.Email%>
            </td>
            <td>
                <%: item.Address%>
            </td>
            <td>
                <%: item.Branch%>
            </td>
            <td>
                <%: item.JobType%>
            </td>
        </tr>
    
    <% }
       
     }%>

    </table>

    <p>
        <%: Html.ActionLink("Create New", "Create") %>
    </p>

</asp:Content>

